package com.dfec.book.util;

import com.baomidou.mybatisplus.annotation.TableField;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * 分页入参
 *
 * @author tangrg
 * @email 1446232546@qq.com
 * @date 2025-06-19 10:43:40
 */
public class BasePage implements Serializable {

    private static final Integer PAGE_NO = 1;

    private static final Integer PAGE_SIZE = 10;

    @NotNull(message = "页码不能为空")
    @Min(value = 1, message = "页码最小值为 1")
    @TableField(exist = false)
    private Integer pageNo = PAGE_NO;

    @NotNull(message = "每页条数不能为空")
    @Min(value = 1, message = "每页条数最小值为 1")
    @Max(value = 100, message = "每页条数最大值为 100")
    @TableField(exist = false)
    private Integer pageSize = PAGE_SIZE;


    public @NotNull(message = "页码不能为空") @Min(value = 1, message = "页码最小值为 1") Integer getPageNo() {
        return pageNo;
    }

    public void setPageNo(@NotNull(message = "页码不能为空") @Min(value = 1, message = "页码最小值为 1") Integer pageNo) {
        this.pageNo = pageNo;
    }

    public @NotNull(message = "每页条数不能为空") @Min(value = 1, message = "每页条数最小值为 1") @Max(value = 100, message = "每页条数最大值为 100") Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(@NotNull(message = "每页条数不能为空") @Min(value = 1, message = "每页条数最小值为 1") @Max(value = 100, message = "每页条数最大值为 100") Integer pageSize) {
        this.pageSize = pageSize;
    }
}




